export default [
    {
        path:"/home",
        name:"Home",
        component:()=>import("@/views/Home"),
    },
    {
        path:"/login",
        name:"Login",
        component:()=>import("@/views/Login"),
        meta:{
            FooterIsHidden:true
        }
    },
    {
        path:"/register",
        name:"Register",
        component:()=>import("@/views/Register"),
        meta:{
            FooterIsHidden:true
        }
    },
    {
        path:"/search/:keyword?",
        name:"Search",
        component:()=>import("@/views/Search"),
        props(route){
            return {
                ...route.query,
                ...route.params
            }
        }
    },
    {
        path:"/detail/:skuId?",
        name:"Detail",
        component:()=>import("@/views/Detail"),
    },
    {
        path:"/addCartSuccess",
        name:"AddCartSuccess",
        component:()=>import("@/views/AddCartSuccess"),
    },
    {
        path:"/shopCart",
        name:"ShopCart",
        component:()=>import("@/views/ShopCart"),
    },
    {
        path:"/trade",
        name:"Trade",
        component:()=>import("@/views/Trade"),
        beforeEnter: (to, from, next) => {
            if(from.name==="ShopCart"){
                next()
            }else{
                next("ShopCart")
            }
        }
    },
    {
        path: "/center",
        name: "Center",
        component: () => import("@/views/Center"),
        redirect: "/center/myOrder",
        children: [
          {
            path: "myOrder",
            name: "MyOrder",
            component: () => import("@/views/Center/components/MyOrder"),
          },
          {
            path: "teamOrder",
            name: "TeamOrder",
            component: () => import("@/views/Center/components/TeamOrder"),
          },
        ],
      },
    {
        path:"/pay",
        name:"Pay",
        component:()=>import("@/views/Pay"),
        beforeEnter: (to, from, next) => {
            if(from.name==="Trade"){
                next()
            }else{
                next("ShopCart")
            }
        }
    },
    {
        path:"/paySuccess",
        name:"PaySuccess",
        component:()=>import("@/views/PaySuccess"),
        beforeEnter: (to, from, next) => {
            if(from.name==="Pay"){
                next()
            }else{
                next("ShopCart")
            }
        }
    },
    {
        path:"/",
        redirect:"/home"
    },
    {
        path:"/*",
        name:"NotFount",
        component:()=>import("@/views/404")
    }

]